/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aaron.platform.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 订单的付款信息
 * @author chenzhuohua
 */
@Entity
@Table(name = "fgys_payment_info")
@SequenceGenerator(name="FGYS_PAYMENTINFO_GENERATOR", sequenceName="FGYS_PAYMENTINFO_GENERATOR", allocationSize = 1)
@NamedQueries({
    @NamedQuery(name = "FgysPayment.findAll", query = "SELECT f FROM FgysPayment f")})
public class FgysPayment implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator="FGYS_PAYMENTINFO_GENERATOR")
    @Column(name = "pay_id")
    private Integer payId;

    /** 付款流水号 */
    @Column(name = "serial_no")
    private String serialNo;

    /** 付款类型:1-初验;2-终验 */
    @Column(name = "pay_type")
    private int payType;

    /** 发票号 */
    @Column(name = "invoice_no")
    private String invoiceNo;

    /** 发票金额 */
    @Column(name = "invoice_value")
    private float invoiceValue;

    /** 付款金额 */
    @Column(name = "pay_value")
    private float payValue;

    /** 付款日期 */
    @Column(name = "pay_date")
    @Temporal(TemporalType.DATE)
    private Date payDate;

    /** 付款说明 */
    @Column(name = "payment_help")
    private String paymentHelp;

    /** 付款备注 */
    @Column(name = "payment_remarks")
    private String paymentRemarks;

    /** 是否已支付 */
    @Column(name = "is_payed")
    private boolean payed;

    /** 订单信息 */
    @JoinColumn(name = "order_id", referencedColumnName = "order_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private FgysOrderInfo orderInfo;

    public FgysPayment() {
    }

    public FgysPayment(Integer payId) {
        this.payId = payId;
    }

    public Integer getPayId() {
        return payId;
    }

    public void setPayId(Integer payId) {
        this.payId = payId;
    }

    public String getSerialNo() {
        return serialNo;
    }

    public void setSerialNo(String serialNo) {
        this.serialNo = serialNo;
    }

    public int getPayType() {
        return payType;
    }

    public void setPayType(int payType) {
        this.payType = payType;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }


    public float getInvoiceValue() {
        return invoiceValue;
    }

    public void setInvoiceValue(float invoiceValue) {
        this.invoiceValue = invoiceValue;
    }

    public boolean isPayed() {
        return payed;
    }

    public void setPayed(boolean payed) {
        this.payed = payed;
    }

    public float getPayValue() {
        return payValue;
    }

    public void setPayValue(float payValue) {
        this.payValue = payValue;
    }

    public Date getPayDate() {
        return payDate;
    }

    public void setPayDate(Date payDate) {
        this.payDate = payDate;
    }

    public FgysOrderInfo getOrderInfo() {
        return orderInfo;
    }

    public void setOrderInfo(FgysOrderInfo orderInfo) {
        this.orderInfo = orderInfo;
    }

    public String getPaymentHelp() {
        return paymentHelp;
    }

    public void setPaymentHelp(String paymentHelp) {
        this.paymentHelp = paymentHelp;
    }

    public String getPaymentRemarks() {
        return paymentRemarks;
    }

    public void setPaymentRemarks(String paymentRemarks) {
        this.paymentRemarks = paymentRemarks;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (payId != null ? payId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FgysPayment)) {
            return false;
        }
        FgysPayment other = (FgysPayment) object;
        if ((this.payId == null && other.payId != null) || (this.payId != null && !this.payId.equals(other.payId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.aaron.platform.entity.FgysPayment[payId=" + payId + "]";
    }
}
